/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.sarco.bwi.web;

import com.sarco.bwi.lib.Config;
import com.sarco.bwi.lib.mysql.Master;
import com.sarco.bwi.lib.Node;

/**
 *
 * @author iktsup
 */
public class Database {
    public String getData() {
        Master mysql = new Master();
        Config config = new Config();

        config.loadConfig(Config.DEFAULT_CONFIG);
        mysql.connect(config.getMysql_host(),
                config.getMysql_user(),
                config.getMysql_pass(),
                config.getMysql_db());
        mysql.populateNodeData();

        Node[] nodes = mysql.getNodes();

        String s = "";
        for (int i = 0; i < nodes.length; i++) {
            s += nodes[i].getSystem() + "<br>";
        }

        return s;
    }

    public void setData(String data) { }
}
